import React from 'react';
import { Route, IndexRoute } from 'react-router';
import BlankWindow from './components/BlankWindow';
import MyAppContainer from './containers/MyAppContainer';
import LoginContainer from './containers/LoginContainer';
import CheckoutDetailContainer from './containers/CheckoutDetailContainer';
import { needAuth } from './utils/func';

/*
如果有定义父子关系的路由，则父路由中需要 this.props.children 才能在对应的地方加载子路由中内容
*/
export default (
	<Route path="/" component={BlankWindow}>
		<IndexRoute component={MyAppContainer} onEnter={needAuth}/>
		<Route path="checkout-detail/:checkout_id" component={CheckoutDetailContainer} onEnter={needAuth}/>
		<Route path="login" component={LoginContainer} />
	</Route>
);